<template>
    <div style="width: 80%; margin: 0 auto" >
      <div> 
        作业编号：<el-input v-model="params.id" size="small" style="width: 15%"></el-input>
        司机姓名:<el-input  v-model="params.name" size="small" style="width: 15%"></el-input>
        作业状态:<el-select v-model="params.status"  clearable placeholder="请选择">
    <el-option v-for="item in statushh" :key="item.id" :label="item.name" :value="item.id"></el-option>
  </el-select><br/><br/>
        运输任务编号：<el-input style="width: 65%"   v-model="params.taskTransportId" size="small" ></el-input>
        <el-button type="primary"   @click="DriverJob()" style="margin-left: 770px; margin-top: 10px;">搜索</el-button>
      </div>
      <el-table :data="DriverJobs" stripe>
          <el-table-column prop="id" label="作业编号"></el-table-column>
          <el-table-column prop="name" label="司机姓名"></el-table-column>
          <el-table-column prop="jgName" label="所属转运中心"></el-table-column>
          <el-table-column prop="truck.licensePlate" label="车牌号码"></el-table-column>
          <el-table-column prop="planDepartureTime" label="计划发车时间"></el-table-column>
          <el-table-column prop="actualArrivalTime" label="实际到达时间"></el-table-column>
          <el-table-column prop="taskTransportId" label="运输任务编号"></el-table-column>
          <el-table-column label="作业状态">
            <template scope="s">
             {{statushh[s.status-1].name}}
            </template>
        </el-table-column>
      </el-table>
    
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="params.num"
        :page-sizes="[1, 5, 10, 15]" :page-size="params.size" layout="total, sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>
  </template>
  
  <script>
   import {DriverJob} from "@/api/driver.js"
    export default {
      data() {
        return {
          DriverJobs: [],
          statushh:[
            {id:1,name:'待提货'},
            {id:2,name:'在途'},
            {id:3,name:'已交付'},
            {id:4,name:'已作废'},
          ],
          total: 0,
          params: {id:'',name:'',status:'',taskTransportId:'',num: 1, size: 5},
        };
      },
      methods: {
        getDriverJob(){
          DriverJob(this.params).then(data => {
          console.log(data.data)            
          this.DriverJobs = data.data.list
          this.total = data.data.total
        })
      },
        
      
         //每页记录数改变事件
        handleSizeChange(val) {
          this.params.size = val
          this.getDriverJob();
        },
        //当前页改变事件
        handleCurrentChange(val) {
          this.params.num = val
          this.getDriverJob();
        },
       
      },
       created(){
          this.getDriverJob();
        }
 
    };
  </script>
  
  <style>
  </style>